/**
 * Created by Administrator on 2017/3/2 0002.
 */
var Page0={
    create:function () {
    var page={};
        page.ui=new PIXI.DisplayObjectContainer();
        page.ui.on('pointerdown',function (e) {
            page.ui.interactive=false;
            page.ui.parent.removeChild(page.ui)
            document.getElementById('mVideo').play();
            document.getElementById('mVideo').style.width=1136*pixiStage.scale.x+'px';
            document.getElementById('mVideo').style.height=540*pixiStage.scale.y+'px';
            document.getElementById('mVideo').style.position='absolute';
            document.getElementById('mVideo').style.left= pixiStage.scale.x*0+pixiStage.x+'px';
            document.getElementById('mVideo').style.top= pixiStage.scale.y*0+pixiStage.y+'px';

            var md=document.getElementsByTagName("video")[0];
            md.addEventListener("ended",function(){
                setTimeout(function () {
                    volumeChange(1)
                    document.dispatchEvent(new CustomEvent('Game_PageIn',{'detail':0}));
                    document.getElementById('div_2d').style.zIndex=99;
                    document.getElementById('mVideo').style.display='none';
                    document.getElementById('mVideo').style.opacity=0;
                },0)

            });

            // document.dispatchEvent(new CustomEvent('Game_PageIn',{'detail':0}));
            // document.getElementById('div_2d').style.zIndex=99;
            // document.getElementById('mVideo').style.display='none';
            // document.getElementById('mVideo').style.opacity=0;
        });
        var ob=Easy.CreateJSONGroup(json_group0,page.ui);

        page.ui.addChild(ob.p0_bg);
        page.ui.addChild(ob.p0_man);
        page.ui.addChild(ob.p0_d0);
        ob.p0_d0.blendMode=PIXI.BLEND_MODES.SCREEN;
        page.ui.addChild(ob.p0_t0);
        // ob.p0_t0.blendMode=PIXI.BLEND_MODES.SCREEN;
        page.ui.addChild(ob.p0_t1);
        page.ui.addChild(ob.p0_t2);
        ob.p0_t2.alpha=0;
        page.ui.addChild(ob.p0_d1);
        ob.p0_d1.blendMode=PIXI.BLEND_MODES.SCREEN;
        page.ui.addChild(ob.p0_h0);
        ob.p0_h0.alpha=0;
        page.ui.addChild(ob.p0_h1);
        ob.p0_h1.alpha=0;
        page.ui.addChild(ob.p0_h2);
        ob.p0_h2.alpha=0;
        page.ui.addChild(ob.p0_h3);
        ob.p0_h3.alpha=0;
        page.ui.addChild(ob.p0_d2);

        ob.p0_d2.blendMode=PIXI.BLEND_MODES.SCREEN;
        page.ui.addChild(ob.p0_d3);
        ob.p0_d3.alpha=0;



        // var click=Easy.CreateSprite('assets/images/click.png',370,1058,0.5,0.5,1);
        // page.ui.addChild(click);
        // TweenMax.to(click.scale,0.7,{yoyo:true,repeat:-1,x:0.85,y:0.85,ease:Cubic.easeInOut});

        page.In=function () {
            ob.p0_bg.scale.set(2);
            TweenMax.to(ob.p0_bg.scale,1,{delay:0,x:1,y:1,ease:Cubic.easeInOut});
            ob.p0_man.scale.set(2);
            ob.p0_man.alpha=0;
            TweenMax.to(ob.p0_man.scale,1,{delay:0.2,x:1,y:1,ease:Back.easeOut});
            TweenMax.to(ob.p0_man,1,{delay:0.3,alpha:1,ease:Cubic.easeInOut});

            ob.p0_d0.scale.set(0);
            ob.p0_d0.alpha=0;
            TweenMax.to(ob.p0_d0.scale,1,{delay:0.3,x:1,y:1,ease:Back.easeOut});
            TweenMax.to(ob.p0_d0,1,{delay:0.3,alpha:1,ease:Cubic.easeInOut,onComplete:function () {
                TweenMax.to(ob.p0_d0.scale,3,{repeat:-1,yoyo:true,x:1.02,y:1.02,ease:Cubic.easeInOut});
            }});

            ob.p0_d1.scale.set(0);
            ob.p0_d1.alpha=0;
            TweenMax.to(ob.p0_d1.scale,1,{delay:0.4,x:1,y:1,ease:Back.easeOut});
            TweenMax.to(ob.p0_d1,1,{delay:0.4,alpha:1,ease:Cubic.easeInOut});

            ob.p0_d2.scale.set(0);
            ob.p0_d2.alpha=0;
            TweenMax.to(ob.p0_d2.scale,1,{delay:0.5,x:1,y:1,ease:Back.easeOut});
            TweenMax.to(ob.p0_d2,1,{delay:0.5,alpha:1,ease:Cubic.easeInOut,onComplete:function () {
                TweenMax.to(ob.p0_d2,0.5,{repeat:-1,yoyo:true,alpha:0.0,ease:Cubic.easeInOut});
            }});


            ob.p0_t0.alpha=0;
            ob.p0_t0.scale.set(0);
            TweenMax.to(ob.p0_t0.scale,1,{delay:1,x:1,y:1,ease:Back.easeOut,onComplete:function () {
                TweenMax.to(ob.p0_t0.scale,0.7,{yoyo:true,repeat:-1,x:0.97,y:0.97,ease:Cubic.easeInOut});
            }});
            TweenMax.to(ob.p0_t0,1,{delay:1,alpha:1,ease:Cubic.easeInOut});
            ob.p0_t1.alpha=0;
            ob.p0_t1.scale.set(0);
            TweenMax.to(ob.p0_t1.scale,1,{delay:1.2,x:1,y:1,ease:Back.easeOut});
            TweenMax.to(ob.p0_t1,1,{delay:1.2,alpha:1,ease:Cubic.easeInOut});
            TweenMax.to(ob.p0_t1,1,{delay:4,alpha:0,ease:Cubic.easeOut});



            setTimeout(function () {
                ob.p0_t2.alpha=0;
                ob.p0_t2.scale.set(0);
                TweenMax.to(ob.p0_t2.scale,1,{delay:0,x:1,y:1,ease:Back.easeOut});
                TweenMax.to(ob.p0_t2,1,{delay:0,alpha:1,ease:Cubic.easeInOut});

                ob.p0_h0.alpha=0;
                ob.p0_h0.scale.set(0);
                TweenMax.to(ob.p0_h0.scale,1,{delay:0.2*1,x:1,y:1,ease:Back.easeOut});
                TweenMax.to(ob.p0_h0,1,{delay:0.2*1,alpha:1,ease:Cubic.easeInOut,onComplete:function () {
                    TweenMax.to(ob.p0_h0,1,{yoyo:true,repeat:-1,x:ob.p0_h0.x+Math.random()*20-10,y:ob.p0_h0.y+Math.random()*30-15,ease:Cubic.easeInOut});
                }});
                ob.p0_h1.alpha=0;
                ob.p0_h1.scale.set(0);
                TweenMax.to(ob.p0_h1.scale,1,{delay:0.2*2,x:1,y:1,ease:Back.easeOut});
                TweenMax.to(ob.p0_h1,1,{delay:0.2*2,alpha:1,ease:Cubic.easeInOut,onComplete:function () {
                    TweenMax.to(ob.p0_h1,1,{yoyo:true,repeat:-1,x:ob.p0_h1.x+Math.random()*20-10,y:ob.p0_h1.y+Math.random()*30-15,ease:Cubic.easeInOut});
                }});
                ob.p0_h2.alpha=0;
                ob.p0_h2.scale.set(0);
                TweenMax.to(ob.p0_h2.scale,1,{delay:0.2*3,x:1,y:1,ease:Back.easeOut});
                TweenMax.to(ob.p0_h2,1,{delay:0.2*3,alpha:1,ease:Cubic.easeInOut,onComplete:function () {
                    TweenMax.to(ob.p0_h2,1,{yoyo:true,repeat:-1,x:ob.p0_h2.x+Math.random()*20-10,y:ob.p0_h2.y+Math.random()*30-15,ease:Cubic.easeInOut});
                }});
                ob.p0_h3.alpha=0;
                ob.p0_h3.scale.set(0);
                TweenMax.to(ob.p0_h3.scale,1,{delay:0.2*4,x:1,y:1,ease:Back.easeOut});
                TweenMax.to(ob.p0_h3,1,{delay:0.2*4,alpha:1,ease:Cubic.easeInOut,onComplete:function () {
                    TweenMax.to(ob.p0_h3,1,{yoyo:true,repeat:-1,x:ob.p0_h3.x+Math.random()*20-10,y:ob.p0_h3.y+Math.random()*30-15,ease:Cubic.easeInOut});
                }});

                ob.p0_d3.scale.set(2);
                ob.p0_d3.alpha=0;
                TweenMax.to(ob.p0_d3.scale,1,{delay:1,x:1,y:1,ease:Cubic.easeInOut});
                TweenMax.to(ob.p0_d3,1,{delay:1,alpha:1,ease:Cubic.easeInOut,onComplete:function () {
                    TweenMax.to(ob.p0_d3.scale,0.9,{repeat:-1,yoyo:true,x:0.95,y:0.95,ease:Linear.easeNone});
                }});


            },4000);



            setTimeout(function () {
                page.ui.interactive=true;
            },5000);
        }
        page.Out=function () {
            console.log('out');
        }

       
    return page;
    }
}